package com.lad.springboot_mybatis.service;

import com.lad.springboot_mybatis.entity.User;
import com.lad.springboot_mybatis.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Service
public class SaveService {
    @Autowired
    UserMapper userMapper;

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void saveB() {
        User user = new User();
        user.setId(2);
        user.setUserName("ls");
        userMapper.insertUser(user);
        int i = 1/0;
    }
}
